<?php
$ma_donvi=$_GET['donvi'];
$namkhoahoc=$_GET['namkhoahoc'];
include('../../configs/connect.php');   
mysql_query("SET NAMES 'UTF8'");
 
$sql="  Select a.madm_nganh,ten_nganh 
        FROM tbl_ctdt a,dm_nganh b, tbl_donvi_ctdt c, tbl_khoahoc d
        WHERE a.ma_ctdt = c.ma_ctdt
        AND   c.id_dv_ctdt=d.id_dv_ctdt
        AND   a.madm_nganh=b.madm_nganh
        AND   c.ma_donvi='$ma_donvi'
        AND   d.nam_khoahoc='$namkhoahoc'";
  
$q=mysql_query($sql);
echo mysql_error();
echo "<select name='nganh' id='nganh' onchange='xetlop();xetds()'>";
echo "<option value='0'>--------------------Chọn ngành------------------</option>";
while($nt=mysql_fetch_array($q)){   
    echo "<option id='chonnganh' name='chonnganh' value=".$nt['madm_nganh'].">".$nt['ten_nganh']."</option>";
}
echo "</select>";
?>